#!/usr/bin/env python

import sys

from seisflows.tools import unix
from seisflows.config import load


if __name__ == '__main__':
    """ Executes workflow previously submitted through job scheduler such as
        PBS, LSF, or SLURM
    """

    unix.cd(sys.argv[1])

    # reload saved state
    load(sys.argv[1])

    # create handles
    workflow = sys.modules['seisflows_workflow']
    system = sys.modules['seisflows_system']

    # execute workflow
    workflow.main()

